package com.app.controller;

import com.app.annotation.UrlMapper;
import com.app.conf.AppConfig;
import com.app.service.ServiceA;
import com.app.service.ServiceB;
import com.app.util.tools.ThreadCache;
import com.jfinal.core.Controller;

@UrlMapper(val="/demo")
public class DemoController extends Controller
{
	
	private ThreadCache cache = AppConfig.getAppConfig().getCache();
	
	public void index()
	{
		
		System.out.println("ID:"+Thread.currentThread().getId());
		
		renderText("JFinal->DemoController->IndexAction");
	}
	
	
	public void demo()
	{
		cache.addln("snake:"+System.currentTimeMillis());
		
		new ServiceA().hello();
		
		new ServiceB().hello();
		
		renderText(cache.addln("JFinal->DemoController->IndexAction"));
	}
	
	public void count()
	{
		ThreadCache cache = AppConfig.getAppConfig().getCache();
		
		renderText("count:"+cache.count());
	}
	
	public void get()
	{
		ThreadCache cache = AppConfig.getAppConfig().getCache();
		
		renderText("value:"+cache.get());
	}
}
